module UsersHelper

	class RuntimeRegistry
		extend ActiveSupport::PerThreadRegistry

		attr_accessor :tag_lists
	end

	def gravatar_for(user,options={size: 80})
		#1根据用户邮箱显示gravatar头像服务器的头像
		# size= options[:size]
		# hash = Digest::MD5::hexdigest(user.email.downcase)
		# image_src = "http://www.gravatar.com/avatar/#{hash}?s=#{size}"
		#
		# image_tag image_src

		# 2根据图片在七牛的hash显示图片
		# @image=user.
		defaultpic='userid206693time20090925052730.jpg'
		if user.head_pic.present?
			image_tag(qiniu_image_by_hash(user.head_pic),size: '100')
		else
			image_tag(qiniu_image_by_hash(defaultpic),size: '100')

		end

	end

end
